package com.siren.tank.group;

import com.siren.tank.*;

import java.awt.*;

/**
 * @author : wangjichao
 * @description:
 * @date : 2020/7/26 18:50
 */
public abstract class Bullet extends GameObject {

    public static int WIDTH = ResourceMgr.bulletD.getWidth();
    public static int HEIGHT = ResourceMgr.bulletD.getHeight();

    protected static final int SPEED = 10;

    protected int x, y;
    protected Dir dir;
    protected boolean live = true;
    protected Group group;

    public boolean isLive() {
        return live;
    }

    public void setLive(boolean live) {
        this.live = live;
    }

    public Bullet(int x, int y, Dir dir) {
        super();
        this.x = x;
        this.y = y;
        this.dir = dir;
        GameModel.getInstance().add(this);
    }

    @Override
    public abstract void paint(Graphics g);

    public Group getGroup() {
        return group;
    }

    public void setGroup(Group group) {
        this.group = group;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public void die() {
        this.live = false;
    }
}
